package com.yuhong.springbootinit.controller;

import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @BelongsProject: resume-analysis-system
 * @BelongsPackage: com.yuhong.springbootinit.controller
 * @Author: renyuhong
 * @CreateTime: 2025-05-04  17:21
 * @Description:
 * @Version: 1.0
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/pdf")
    public ResponseEntity<Resource> getPdf() throws IOException {
        FileSystemResource resource = new FileSystemResource("E:/resumes/resume.pdf");
        return ResponseEntity.ok()
                .contentType(MediaType.APPLICATION_PDF)
                .body(resource);
    }
}
